import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/dashboard",
  },
  {
    path: "/",
    meta: { title: "组合" },
    component: () =>
      import(/* webpackChunkName: "about" */ "../components/common/Home.vue"),
    children: [
      {
        path: "/dashboard",
        component: () =>
          import(
            /* webpackChunkName: "dashboard" */ "../components/page/Dashboard.vue"
          ),
        meta: { title: "系统首页" },
      },
      {
        path: "/app",
        component: () =>
          import(
            /* webpackChunkName: "dashboard" */ "../components/page/App.vue"
          ),
        meta: { title: "应用管理" },
      },
      {
        path: "/task",
        component: () =>
          import(
            /* webpackChunkName: "dashboard" */ "../components/page/Task.vue"
          ),
        meta: { title: "任务管理" },
      },
      {
        path: "/task_log",
        component: () =>
          import(
            /* webpackChunkName: "dashboard" */ "../components/page/TaskLog.vue"
          ),
        meta: { title: "任务日志管理" },
      },
      {
        path: "/404",
        component: () =>
          import(/* webpackChunkName: "404" */ "../components/page/404.vue"),
        meta: { title: "404" },
      },
      {
        path: "/403",
        component: () =>
          import(/* webpackChunkName: "403" */ "../components/page/403.vue"),
        meta: { title: "403" },
      },
    ],
  },
  {
    path: "*",
    redirect: "/404",
  },
  {
    path: "/login",
    component: () =>
      import(/* webpackChunkName: "403" */ "../components/page/Login.vue"),
    meta: { title: "登录" },
  },
];

const router = new VueRouter({
  routes,
});

export default router;
